/**
 * 
 */
package gpl.scotlandyard.utils;

import java.io.Serializable;

/** Simple point with x and y coordinates. This is a mutable object.
 * @author Norbert */
public final class Point implements Cloneable, Serializable {

  private static final long serialVersionUID = 1L;
  private int x;
  private int y;

  /** Creates point (0,0). */
  public Point() {
    x = 0;
    y = 0;
  }

  /** Creates point (x,y). */
  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }

  /** @return x */
  public int getX() {
    return x;
  }

  /** @param x to set */
  public void setX(int x) {
    this.x = x;
  }

  /** @return y */
  public int getY() {
    return y;
  }

  /** @param y to set */
  public void setY(int y) {
    this.y = y;
  }

  /** Moves point to given (x,y).
   * @param x
   * @param y */
  public void move(int x, int y) {
    this.x = x;
    this.y = y;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof Point) {
      Point p = (Point) obj;
      return x == p.x && y == p.y;
    }
    return false;
  };

  @Override
  public Point clone() {
    return new Point(x, y);
  }
}
